﻿using System;
using System.Collections.Generic;
using System.Text;
using He.Common;

namespace He.API.WeiXin
{
    public class Config
    {
        private static Model.webset _webset;
        private static Model.wx_config _wx_config;
        private static Model.site_info _site_info;
        private static string _sitedomain = "";
        private static string _siteurl = "";


        /// <summary>
        /// 网站配置
        /// </summary>
        public static Model.webset webset
        {
            set
            {
                _webset = value;
            }
            get
            {
                return new BLL.webset().GetWebset();
            }
        }

        /// <summary>
        /// 微信配置
        /// </summary>
        public static Model.wx_config wx_config
        {
            set
            {
                _wx_config = value;
            }
            get
            {
                return new BLL.wx_config().LoadConfig();
            }
        }

        /// <summary>
        /// 网站信息
        /// </summary>
        public static Model.site_info site_info
        {
            set
            {
                _site_info = value;
            }
            get
            {
                return new BLL.site_info().GetModelByLang(SysKeys.WEIXIN_LANG_NAME);
            }
        }

        /// <summary>
        /// 网站域名
        /// </summary>
        public static string SiteDomain
        {
            set
            {
                _sitedomain = value;
            }
            get
            {
                return webset.site_domain.Replace("http://", "").Trim('/');
            }
        }

        /// <summary>
        /// 网站URL
        /// </summary>
        public static string SiteUrl
        {
            set
            {
                _siteurl = value;
            }
            get
            {
                return string.Format("http://{0}", SiteDomain);
            }
        }
    }
}
